#! /bin/sh /usr/share/dpatch/dpatch-run
## 01_makefile.dpatch by  <jochen@scram.de>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: New patch generated from libgsm 1.0.10-14 diff.gz

@DPATCH@
diff -urNad libgsm-1.0.12~/Makefile libgsm-1.0.12/Makefile
--- libgsm-1.0.12~/Makefile	2007-11-01 15:37:52.000000000 +0100
+++ libgsm-1.0.12/Makefile	2007-11-01 15:43:06.000000000 +0100
@@ -96,7 +96,7 @@
 #  Other tools
 
 SHELL		= /bin/sh
-LN		= ln
+LN		= ln -s
 BASENAME 	= basename
 AR		= ar
 ARFLAGS		= cr
@@ -140,6 +140,7 @@
 # Targets
 
 LIBGSM	= $(LIB)/libgsm.a
+LIBGSMSO= $(LIB)/libgsm.so
 
 TOAST	= $(BIN)/toast
 UNTOAST	= $(BIN)/untoast
@@ -279,7 +280,7 @@
 
 # Target rules
 
-all:		$(LIBGSM) $(TOAST) $(TCAT) $(UNTOAST)
+all:		$(LIBGSM) $(LIBGSMSO) $(TOAST) $(TCAT) $(UNTOAST)
 		@-echo $(ROOT): Done.
 
 tst:		$(TST)/lin2cod $(TST)/cod2lin $(TOAST) $(TST)/test-result
@@ -299,6 +300,11 @@
 
 # The basic API: libgsm
 
+$(LIBGSMSO):	$(LIB) $(GSM_OBJECTS)
+		$(LD) -o $@.1.0.12 -shared -Xlinker -soname -Xlinker libgsm.so.1 $(GSM_OBJECTS) -lc
+		ln -fs libgsm.so.1.0.12 lib/libgsm.so.1
+		ln -fs libgsm.so.1.0.12 lib/libgsm.so
+
 $(LIBGSM):	$(LIB) $(GSM_OBJECTS)
 		-rm $(RMFLAGS) $(LIBGSM)
 		$(AR) $(ARFLAGS) $(LIBGSM) $(GSM_OBJECTS)
@@ -308,15 +314,15 @@
 # Toast, Untoast and Tcat -- the compress-like frontends to gsm.
 
 $(TOAST):	$(BIN) $(TOAST_OBJECTS) $(LIBGSM)
-		$(LD) $(LFLAGS) -o $(TOAST) $(TOAST_OBJECTS) $(LIBGSM) $(LDLIB)
+		$(LD) $(LFLAGS) -o $(TOAST) $(TOAST_OBJECTS) $(LIBGSMSO) $(LDLIB)
 
 $(UNTOAST):	$(BIN) $(TOAST)
 		-rm $(RMFLAGS) $(UNTOAST)
-		$(LN) $(TOAST) $(UNTOAST)
+		$(LN) toast $(UNTOAST)
 
 $(TCAT):	$(BIN) $(TOAST)
 		-rm $(RMFLAGS) $(TCAT)
-		$(LN) $(TOAST) $(TCAT)
+		$(LN) toast $(TCAT)
 
 
 # The local bin and lib directories
@@ -426,7 +432,9 @@
 
 clean:	semi-clean
 		-rm $(RMFLAGS) $(LIBGSM) $(ADDTST)/add		\
-			$(TOAST) $(TCAT) $(UNTOAST)	\
+			$(LIBGSMSO) $(LIB)/libgsm.so.1.0.12	\
+			$(LIB)libgsm.so.1			\
+			$(TOAST) $(TCAT) $(UNTOAST)		\
 			$(ROOT)/gsm-1.0.tar.Z
 
 
